home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Misc Servers / Hamster.EXE / Demo-Session.pl < prev    next >
Text File  |  1999-05-06  |  2KB  |  55 lines

  1. # Demo-Session.pl
  2.  
  3. use Win32::OLE;
  4. use Win32::Event;
  5.  
  6. # Preferences
  7. $RASDIAL_CONNECTION     = "";        # Name of RAS-conn; "" = disable dialing
  8. $RASDIAL_USERNAME       = "";        # Username for RAS-conn; "" = use Hamster-setting
  9. $RASDIAL_PASSWORD       = "";        # Password for RAS-conn; "" = use Hamster-setting
  10. $PURGE_BEFORE_TRANSFER  = 0;         # 1 = enable purging
  11.  
  12. # Initialize Hamster-constants
  13. $HAM_PURGEOPT_DOALL     = 0xff;
  14. $HAM_PURGEOPT_DONEWS    = 0x1;
  15. $HAM_PURGEOPT_DOHISTORY = 0x2;
  16. $HAM_PURGEOPT_DOKILLS   = 0x4;
  17. $HAM_WAITIDLE_INFINITE  = 0;
  18.  
  19. # Initialize Hamster-objects
  20. # Note: Hamster.exe will be started now if it does not run already.
  21. print "Initializing Hamster ...\n";
  22. $Hamster = Win32::OLE->new("Hamster.App");
  23. $evtHamsterIsIdle = Win32::Event->open("evtHamster.IsIdle");
  24.  
  25. if( $PURGE_BEFORE_TRANSFER ) {
  26.     print "Purging ...\n";
  27.     $evtHamsterIsIdle->wait();
  28.     $Hamster->ControlRunPurge( $HAM_PURGEOPT_DOALL );
  29.     $evtHamsterIsIdle->wait();
  30. }
  31.  
  32. if( $RASDIAL_CONNECTION ne "" ) {
  33.     print "Dialing ...\n";
  34.     $Hamster->RasDial( $RASDIAL_CONNECTION, $RASDIAL_USERNAME, $RASDIAL_PASSWORD )
  35.       || die "RasDial failed with RasLastError=", $Hamster->RasLastError;
  36. }
  37.  
  38. print "Transfering ...\n";
  39. $Hamster->ControlRunMail( "" );
  40. $Hamster->ControlRunNewsPost( "" );
  41. $Hamster->ControlRunNewsPull( "" );
  42. $evtHamsterIsIdle->wait();
  43.  
  44. if( $RASDIAL_CONNECTION ne "" ) {
  45.     print "Hanging up ...\n";
  46.     $Hamster->RasHangup;
  47. }
  48.  
  49. # Release Hamster-object
  50. print "Release Hamster ...\n";
  51. undef $Hamster;
  52.  
  53. print "Ready.\n";
  54.  
  55.